{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb5}
		</small>
	</h1>
</div>
<div class="page-header">
	<a href="{:url('Contract/rate_add')}" class="btn btn-primary">新增</a>
</div>
<form action="{:url('Contract/rate_config')}" method="get">
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>
				<select name="info_id">
					<option value="">请选择合约名称</option>
					{volist name="info" id="info"}
					<option value="{$info.id}" {if condition="$info.id eq input('info_id')"} selected {/if}>{$info.name}</option>
					{/volist}
				</select>&nbsp;&nbsp;&nbsp;
				<select name="time_id">
					<option value="">请选择时间</option>
					{volist name="time" id="time"}
					<option value="{$time.id}" {if condition="$time.id eq input('time_id')"} selected {/if}>{$time.num}{:get_contract_time_type($time.type)}</option>
					{/volist}
				</select>&nbsp;&nbsp;&nbsp;
				<select name="money_id">
					<option value="">请选择区间</option>
					{volist name="money" id="money"}
					<option value="{$money.id}" {if condition="$money.id eq input('money_id')"} selected {/if}>{$money.min_price}--{$money.max_price}</option>
					{/volist}
				</select>&nbsp;&nbsp;&nbsp;
				<button class="btn btn-primary">查询</button>&nbsp;&nbsp;&nbsp;
				<a href="{:url('Contract/rate_config')}" class="btn btn-primary">清空查询条件</a>
			</th>
		</tr>
		</thead>
	</table>
</form>
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>id</th>
						<th>合约名称</th>
						<th>价格区间</th>
						<th>时间周期</th>
						<th>利率</th>
						<th>备注</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v"}
						<tr>						
							<td>{$v.id}</td>
							<td>{$v.name}</td>
							<td>{$v.min_price}元—{$v.max_price}元</td>
							<td>{$v.num}{:get_contract_time_type($v.type)}</td>
							<td>{$v.rate}</td>
							<td>{$v.remark}</td>
							<td>
								{switch name="v.state"}
								{case value="1"}<a href='{:url("Contract/rate_state",array("id"=>$v["id"],"status"=>0))}' title="禁用"><span class="btn btn-xs btn-success"><i class="fa fa-check bigger-120"></i></span></a>{/case}
								{case value="0"}<a href='{:url("Contract/rate_state",array("id"=>$v["id"],"status"=>1))}' title="启用"><span class="btn btn-xs btn-danger"><i class="fa fa-remove bigger-120"></i></span></a>{/case}
								{/switch}
							</td>
							<td>
								<a  class="btn btn-xs btn-info" href='{:url("Contract/rate_update",array("id"=>$v["id"]))}'>
									<i class="fa fa-edit bigger-120"></i>
								</a>
								<a class="delete btn btn-xs btn-danger" href='{:url("Contract/del",array("model"=>"contract_rate_config","id"=>$v["id"]))}' >
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
				</tbody>
			</table>
		</div>
		{$page}
	</div>
</div>
{/block}
{block name="javascript"}
<script>	
$(function(){
   $("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });	

      $("#search1").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        //alert(url);
        window.location.href = url;
    });	
});
</script>
{/block}